/*
	@file: log/source/formatter_creator/StringFormatterCreator.cpp
	@author: Wolfhead
 */
#include "formatter_creator/StringFormatterCreator.h"
#include "formatter/StringFormatter.h"
#include "Log.h"
#include "Builder.h"

namespace logger
{

FormatterPtr StringFormatterCreator::create_formatter(
	boost::property_tree::ptree& setting)
{
	try
	{
		std::string format = setting.get<std::string>("format");
		return FormatterPtr(new StringFormatter(format));
	}
	catch (boost::property_tree::ptree_error& ex)
	{
	 	CLOGS(kError) << "StringFormatterCreator::create_formatter "
	 	              << "setting error:" << ex.what();
		return FormatterPtr();
	}
}

}//namespace logger
